function [P] =PLaplacesolver(U,HbyAp,Ap,c_s_)
%求解压力项的拉普拉斯方程
%   此处显示详细说明
global own nei num b U_inlet c_s d
%p_A=zeros(num*3,1);
B=zeros(num,num);
C=zeros(num,1);
HpyA_f=zeros(nei(1),3);
%建立C矩阵
for i=1:nei(1)
    HpyA_f(i,:)=HbyAp(nei(i+1),:)/2+HbyAp(own(i+1),:)/2;
end
for i=1:nei(1)
    C(nei(i+1))=C(nei(i+1))-HpyA_f(i,:)*c_s(i,:)';
    C(own(i+1))=C(own(i+1))+HpyA_f(i,:)*c_s(i,:)';
end
%引入边界条件
for i=1:b.in(1) 
    u=U_inlet;
    C(own(i+b.in(2)))=C(own(i+b.in(2)))+u*c_s(i+b.in(2)-1,:)';
end
for i=1:b.out(1)
    u=U(own(i+b.out(2)),:);
    C(own(i+b.out(2)))=C(own(i+b.out(2)))+u*c_s(i+b.out(2)-1,:)';
end

%建立B矩阵，B*P=C
for i=1:nei(1)
    Ap_f=Ap(nei(i+1))/2+Ap(own(i+1))/2;
    B(own(i+1),nei(i+1))=B(own(i+1),nei(i+1))+c_s_(own(i+1),nei(i+1))/Ap_f/d(own(i+1),nei(i+1));
    B(nei(i+1),own(i+1))=B(nei(i+1),own(i+1))+c_s_(nei(i+1),own(i+1))/Ap_f/d(nei(i+1),own(i+1));
    B(own(i+1),own(i+1))=B(own(i+1),own(i+1))-c_s_(own(i+1),nei(i+1))/Ap_f/d(own(i+1),nei(i+1));
end

%求p矩阵
P=B\C;
end